import base64
from PIL import Image
import io
# import cv2

from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

str = ""

# 提取 base64 部分（删除前缀）
# base64_data = str.split(",")[1]  # 保留逗号后面的 base64 部分
# img_data = base64.b64decode(base64_data)

# image = Image.open(io.BytesIO(img_data))
# image.save('test.jpg')


face_human_hand_detection = pipeline(Tasks.face_human_hand_detection, model='damo/cv_nanodet_face-human-hand-detection')
result_status = face_human_hand_detection('./th.jpeg')
print('labels', result_status[OutputKeys.LABELS])